package com.linked.mystyle.news.service.impl;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.linked.mystyle.news.bean.param.NewsPageParam;
import com.linked.mystyle.news.bean.po.NewsInfoPO;
import com.linked.mystyle.news.mapper.INewsInfoMapper;
import com.linked.mystyle.news.service.INewsInfoService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;


/**
 * @author :dbq
 * @date : 2022/10/28 15:20
 */
@Service
public class NewsInfoServiceImpl implements INewsInfoService {

    private final INewsInfoMapper newsInfoMapper;

    @Autowired
    public NewsInfoServiceImpl(INewsInfoMapper newsInfoMapper) {
        this.newsInfoMapper = newsInfoMapper;
    }

    @Override
    public IPage<NewsInfoPO> queryNewsPage(NewsPageParam param) throws Exception {
        return newsInfoMapper.queryNewsPage(param);
    }

    @Override
    public boolean addNews(NewsInfoPO param) throws Exception {
        return newsInfoMapper.insert(param) > 0;
    }


    @Override
    public boolean doLikes(String newsId) throws Exception {
        return newsInfoMapper.doLikes(newsId) > 0;
    }


}
